<template>
	<view>
		<view class="center">
			<view class=" kecheng_FKM ">
				FKM
			</view>
		</view>
		<view class="center centers">
			<view class="kecheng_body">
				<view class="kecheng_xinxi">
					<view class="tel">
						<view class="tel_size">
							手机号
						</view>
						<view class="tel_input">
							<input v-model="query.username" type="text" placeholder="请输入电话号码" />
						</view>
					</view>
					<view class="pass">
						<input type="text" v-model="query.pass" placeholder="请输入密码" />
					</view>
				</view>
			</view>
			<view class="register_father" @click="postlogin">
				<view class="register">
					登录
				</view>
			</view>
			<view class="deal">
				<view class=" deal_che ">
					<checkbox-group @change="checkme">
						<label>
							<checkbox value="cb" color="22rpx" :checked="check" />
						</label>
					</checkbox-group>
				</view>
				<view class="deal_content">
					<view class="">
						我已阅读并同意
					</view>
					<view class="deal_content_red ">
						《FKM用户协议》
					</view>
					<view class="">
						,
					</view>
					<view class="deal_content_red ">
						《FKM用户协议》
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		tel,
		pass
	} from '@/utils/regular.js'
	import {
		checklogin
	} from '@/api/api.js'
	export default {
		data() {
			return {
				check: false,
				query: {
					
				}
			};
		},
		methods: {
			async postlogin() {
				if (!this.query.username) return this.$mess.error('请填写电话号码')
				// if (!tel.test(this.query.username)) return this.$mess.error('电话号码不正确')
				if (!this.query.pass) return this.$mess.error('请填写密码')
				if (!pass.test(this.query.pass)) return this.$mess.error('电话号码不正确')
				if (!this.check) return this.$mess.error('请勾选协议')
				let res = await checklogin(this.query)
				uni.navigateTo({
					url:'/pages/lianxi/kechenglist/kechenglist'
				})
			},
			checkme() {
				this.check = !this.check
			}
		}
	}
</script>

<style lang="less">
	@import url('login.less');
</style>